package org.jeecg.common.util;

import org.apache.commons.lang.StringUtils;

import java.util.regex.Pattern;

public class ConvertUtil {
    //两位小数金额校验
    public static boolean isMoney(String source) {
        boolean flag = false;
        try {
            if(StringUtils.isEmpty(source)){
                return false;
            }
            // 判断是否是整数或者是携带一位或者两位的小数
            Pattern pattern = Pattern.compile("^[+]?([0-9]+(.[0-9]{1,2})?)$");
            if (pattern.matcher(source).matches()) {
                flag = true;
            }
        } catch (Exception e) {
            e.getMessage();
        }
        return flag;
    }
}
